import request from "../uitls/request.js";
//获取所有activity
/**
 * 需要userid是因为需要查询该用户在该活动下的视频进度
*/
export const getList = (type)=>{
	return request({
		url:'activity/getList',
		method:'GET',
		params:{
			...type,
			userId:uni.getStorageSync("userId")
		}
	})
}

//上传进度
export const updateUserProcess = (type)=>{
	return request({
		url:'record/uploadProcess',
		method:'POST',
		params:{
			...type,
			userId:uni.getStorageSync("userId")
		}
	})
}

//依据id获取活动信息
export const getActivityById = (id)=>{
	return request({
		url:'activity/selectOne',
		method:"GET",
		params:{
			...id,
			userId:uni.getStorageSync("userId")
		}
	})
}


//报名活动
export const signActivity = (data)=>{
	return request({
		url:'sign/add',
		method:"POST",
		params:{
			...data,
			userId:uni.getStorageSync("userId")
		}
	})
}

//查询正在进行的培训
export const getTraining = (data)=>{
	return request({
		url:'record/queryLearnRecordByUserId',
		method:"GET",
		params:{
			userId:uni.getStorageSync("userId"),
			...data,
		}
	})
}

//查看用户是否报名该活动下的培训
export const getUserTraining = (data) =>{
	return request({
		url:'/sign/selectOne',
		method:"POST",
		params:{
			userId:uni.getStorageSync("userId"),
			...data
		}
	})
}

//获取当前活动下视频的必看时长
export const getActivityWatchLength = (data) =>{
	return request({
		url:'/duration/get',
		method:"GET",
		params:data
	})
}